package com.ruoyi.user.exception;

import com.ruoyi.user.enums.BizCodeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @author Lu.F
 * @version 1.0
 * @date 2022/11/11 9:19
 */
@EqualsAndHashCode(callSuper = false)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BizException extends RuntimeException{

    private int code;

    private String msg;

    public BizException(BizCodeEnum bizCodeEnum){
        super(bizCodeEnum.getMsg());
        this.code = bizCodeEnum.getCode();
        this.msg = bizCodeEnum.getMsg();
    }
}
